var $protobuf = window.protobuf;
$protobuf.roots.default=window;
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});

$root.msg = (function() {

    /**
     * Namespace msg.
     * @exports msg
     * @namespace
     */
    var msg = {};

    msg.Person = (function() {

        /**
         * Properties of a Person.
         * @memberof msg
         * @interface IPerson
         * @property {string|null} [username] Person username
         * @property {number|null} [age] Person age
         * @property {number|null} [sex] Person sex
         */

        /**
         * Constructs a new Person.
         * @memberof msg
         * @classdesc Represents a Person.
         * @implements IPerson
         * @constructor
         * @param {msg.IPerson=} [properties] Properties to set
         */
        function Person(properties) {
            if (properties)
                for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                    if (properties[keys[i]] != null)
                        this[keys[i]] = properties[keys[i]];
        }

        /**
         * Person username.
         * @member {string} username
         * @memberof msg.Person
         * @instance
         */
        Person.prototype.username = "";

        /**
         * Person age.
         * @member {number} age
         * @memberof msg.Person
         * @instance
         */
        Person.prototype.age = 0;

        /**
         * Person sex.
         * @member {number} sex
         * @memberof msg.Person
         * @instance
         */
        Person.prototype.sex = 0;

        /**
         * Creates a new Person instance using the specified properties.
         * @function create
         * @memberof msg.Person
         * @static
         * @param {msg.IPerson=} [properties] Properties to set
         * @returns {msg.Person} Person instance
         */
        Person.create = function create(properties) {
            return new Person(properties);
        };

        /**
         * Encodes the specified Person message. Does not implicitly {@link msg.Person.verify|verify} messages.
         * @function encode
         * @memberof msg.Person
         * @static
         * @param {msg.IPerson} message Person message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        Person.encode = function encode(message, writer) {
            if (!writer)
                writer = $Writer.create();
            if (message.username != null && Object.hasOwnProperty.call(message, "username"))
                writer.uint32(/* id 1, wireType 2 =*/10).string(message.username);
            if (message.age != null && Object.hasOwnProperty.call(message, "age"))
                writer.uint32(/* id 2, wireType 0 =*/16).int32(message.age);
            if (message.sex != null && Object.hasOwnProperty.call(message, "sex"))
                writer.uint32(/* id 3, wireType 0 =*/24).int32(message.sex);
            return writer;
        };

        /**
         * Encodes the specified Person message, length delimited. Does not implicitly {@link msg.Person.verify|verify} messages.
         * @function encodeDelimited
         * @memberof msg.Person
         * @static
         * @param {msg.IPerson} message Person message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        Person.encodeDelimited = function encodeDelimited(message, writer) {
            return this.encode(message, writer).ldelim();
        };

        /**
         * Decodes a Person message from the specified reader or buffer.
         * @function decode
         * @memberof msg.Person
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @param {number} [length] Message length if known beforehand
         * @returns {msg.Person} Person
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        Person.decode = function decode(reader, length) {
            if (!(reader instanceof $Reader))
                reader = $Reader.create(reader);
            var end = length === undefined ? reader.len : reader.pos + length, message = new $root.msg.Person();
            while (reader.pos < end) {
                var tag = reader.uint32();
                switch (tag >>> 3) {
                case 1:
                    message.username = reader.string();
                    break;
                case 2:
                    message.age = reader.int32();
                    break;
                case 3:
                    message.sex = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
                }
            }
            return message;
        };

        /**
         * Decodes a Person message from the specified reader or buffer, length delimited.
         * @function decodeDelimited
         * @memberof msg.Person
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @returns {msg.Person} Person
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        Person.decodeDelimited = function decodeDelimited(reader) {
            if (!(reader instanceof $Reader))
                reader = new $Reader(reader);
            return this.decode(reader, reader.uint32());
        };

        /**
         * Verifies a Person message.
         * @function verify
         * @memberof msg.Person
         * @static
         * @param {Object.<string,*>} message Plain object to verify
         * @returns {string|null} `null` if valid, otherwise the reason why it is not
         */
        Person.verify = function verify(message) {
            if (typeof message !== "object" || message === null)
                return "object expected";
            if (message.username != null && message.hasOwnProperty("username"))
                if (!$util.isString(message.username))
                    return "username: string expected";
            if (message.age != null && message.hasOwnProperty("age"))
                if (!$util.isInteger(message.age))
                    return "age: integer expected";
            if (message.sex != null && message.hasOwnProperty("sex"))
                if (!$util.isInteger(message.sex))
                    return "sex: integer expected";
            return null;
        };

        return Person;
    })();

    msg.Address = (function() {

        /**
         * Properties of an Address.
         * @memberof msg
         * @interface IAddress
         * @property {string|null} [pro] Address pro
         * @property {string|null} [city] Address city
         * @property {number|null} [code] Address code
         */

        /**
         * Constructs a new Address.
         * @memberof msg
         * @classdesc Represents an Address.
         * @implements IAddress
         * @constructor
         * @param {msg.IAddress=} [properties] Properties to set
         */
        function Address(properties) {
            if (properties)
                for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                    if (properties[keys[i]] != null)
                        this[keys[i]] = properties[keys[i]];
        }

        /**
         * Address pro.
         * @member {string} pro
         * @memberof msg.Address
         * @instance
         */
        Address.prototype.pro = "";

        /**
         * Address city.
         * @member {string} city
         * @memberof msg.Address
         * @instance
         */
        Address.prototype.city = "";

        /**
         * Address code.
         * @member {number} code
         * @memberof msg.Address
         * @instance
         */
        Address.prototype.code = 0;

        /**
         * Creates a new Address instance using the specified properties.
         * @function create
         * @memberof msg.Address
         * @static
         * @param {msg.IAddress=} [properties] Properties to set
         * @returns {msg.Address} Address instance
         */
        Address.create = function create(properties) {
            return new Address(properties);
        };

        /**
         * Encodes the specified Address message. Does not implicitly {@link msg.Address.verify|verify} messages.
         * @function encode
         * @memberof msg.Address
         * @static
         * @param {msg.IAddress} message Address message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        Address.encode = function encode(message, writer) {
            if (!writer)
                writer = $Writer.create();
            if (message.pro != null && Object.hasOwnProperty.call(message, "pro"))
                writer.uint32(/* id 1, wireType 2 =*/10).string(message.pro);
            if (message.city != null && Object.hasOwnProperty.call(message, "city"))
                writer.uint32(/* id 2, wireType 2 =*/18).string(message.city);
            if (message.code != null && Object.hasOwnProperty.call(message, "code"))
                writer.uint32(/* id 3, wireType 0 =*/24).int32(message.code);
            return writer;
        };

        /**
         * Encodes the specified Address message, length delimited. Does not implicitly {@link msg.Address.verify|verify} messages.
         * @function encodeDelimited
         * @memberof msg.Address
         * @static
         * @param {msg.IAddress} message Address message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        Address.encodeDelimited = function encodeDelimited(message, writer) {
            return this.encode(message, writer).ldelim();
        };

        /**
         * Decodes an Address message from the specified reader or buffer.
         * @function decode
         * @memberof msg.Address
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @param {number} [length] Message length if known beforehand
         * @returns {msg.Address} Address
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        Address.decode = function decode(reader, length) {
            if (!(reader instanceof $Reader))
                reader = $Reader.create(reader);
            var end = length === undefined ? reader.len : reader.pos + length, message = new $root.msg.Address();
            while (reader.pos < end) {
                var tag = reader.uint32();
                switch (tag >>> 3) {
                case 1:
                    message.pro = reader.string();
                    break;
                case 2:
                    message.city = reader.string();
                    break;
                case 3:
                    message.code = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
                }
            }
            return message;
        };

        /**
         * Decodes an Address message from the specified reader or buffer, length delimited.
         * @function decodeDelimited
         * @memberof msg.Address
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @returns {msg.Address} Address
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        Address.decodeDelimited = function decodeDelimited(reader) {
            if (!(reader instanceof $Reader))
                reader = new $Reader(reader);
            return this.decode(reader, reader.uint32());
        };

        /**
         * Verifies an Address message.
         * @function verify
         * @memberof msg.Address
         * @static
         * @param {Object.<string,*>} message Plain object to verify
         * @returns {string|null} `null` if valid, otherwise the reason why it is not
         */
        Address.verify = function verify(message) {
            if (typeof message !== "object" || message === null)
                return "object expected";
            if (message.pro != null && message.hasOwnProperty("pro"))
                if (!$util.isString(message.pro))
                    return "pro: string expected";
            if (message.city != null && message.hasOwnProperty("city"))
                if (!$util.isString(message.city))
                    return "city: string expected";
            if (message.code != null && message.hasOwnProperty("code"))
                if (!$util.isInteger(message.code))
                    return "code: integer expected";
            return null;
        };

        return Address;
    })();

    return msg;
})();

$root.simple = (function() {

    /**
     * Namespace simple.
     * @exports simple
     * @namespace
     */
    var simple = {};

    simple.People = (function() {

        /**
         * Properties of a People.
         * @memberof simple
         * @interface IPeople
         * @property {string} name People name
         * @property {string} address People address
         * @property {string} phone_number People phone_number
         * @property {number} age People age
         * @property {simple.ILocation|null} [location] People location
         */

        /**
         * Constructs a new People.
         * @memberof simple
         * @classdesc Represents a People.
         * @implements IPeople
         * @constructor
         * @param {simple.IPeople=} [properties] Properties to set
         */
        function People(properties) {
            if (properties)
                for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                    if (properties[keys[i]] != null)
                        this[keys[i]] = properties[keys[i]];
        }

        /**
         * People name.
         * @member {string} name
         * @memberof simple.People
         * @instance
         */
        People.prototype.name = "";

        /**
         * People address.
         * @member {string} address
         * @memberof simple.People
         * @instance
         */
        People.prototype.address = "";

        /**
         * People phone_number.
         * @member {string} phone_number
         * @memberof simple.People
         * @instance
         */
        People.prototype.phone_number = "";

        /**
         * People age.
         * @member {number} age
         * @memberof simple.People
         * @instance
         */
        People.prototype.age = 0;

        /**
         * People location.
         * @member {simple.ILocation|null|undefined} location
         * @memberof simple.People
         * @instance
         */
        People.prototype.location = null;

        // OneOf field names bound to virtual getters and setters
        var $oneOfFields;

        /**
         * People _location.
         * @member {"location"|undefined} _location
         * @memberof simple.People
         * @instance
         */
        Object.defineProperty(People.prototype, "_location", {
            get: $util.oneOfGetter($oneOfFields = ["location"]),
            set: $util.oneOfSetter($oneOfFields)
        });

        /**
         * Creates a new People instance using the specified properties.
         * @function create
         * @memberof simple.People
         * @static
         * @param {simple.IPeople=} [properties] Properties to set
         * @returns {simple.People} People instance
         */
        People.create = function create(properties) {
            return new People(properties);
        };

        /**
         * Encodes the specified People message. Does not implicitly {@link simple.People.verify|verify} messages.
         * @function encode
         * @memberof simple.People
         * @static
         * @param {simple.IPeople} message People message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        People.encode = function encode(message, writer) {
            if (!writer)
                writer = $Writer.create();
            writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
            writer.uint32(/* id 2, wireType 2 =*/18).string(message.address);
            writer.uint32(/* id 3, wireType 2 =*/26).string(message.phone_number);
            writer.uint32(/* id 4, wireType 0 =*/32).int32(message.age);
            if (message.location != null && Object.hasOwnProperty.call(message, "location"))
                $root.simple.Location.encode(message.location, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
            return writer;
        };

        /**
         * Encodes the specified People message, length delimited. Does not implicitly {@link simple.People.verify|verify} messages.
         * @function encodeDelimited
         * @memberof simple.People
         * @static
         * @param {simple.IPeople} message People message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        People.encodeDelimited = function encodeDelimited(message, writer) {
            return this.encode(message, writer).ldelim();
        };

        /**
         * Decodes a People message from the specified reader or buffer.
         * @function decode
         * @memberof simple.People
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @param {number} [length] Message length if known beforehand
         * @returns {simple.People} People
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        People.decode = function decode(reader, length) {
            if (!(reader instanceof $Reader))
                reader = $Reader.create(reader);
            var end = length === undefined ? reader.len : reader.pos + length, message = new $root.simple.People();
            while (reader.pos < end) {
                var tag = reader.uint32();
                switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.address = reader.string();
                    break;
                case 3:
                    message.phone_number = reader.string();
                    break;
                case 4:
                    message.age = reader.int32();
                    break;
                case 5:
                    message.location = $root.simple.Location.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
                }
            }
            if (!message.hasOwnProperty("name"))
                throw $util.ProtocolError("missing required 'name'", { instance: message });
            if (!message.hasOwnProperty("address"))
                throw $util.ProtocolError("missing required 'address'", { instance: message });
            if (!message.hasOwnProperty("phone_number"))
                throw $util.ProtocolError("missing required 'phone_number'", { instance: message });
            if (!message.hasOwnProperty("age"))
                throw $util.ProtocolError("missing required 'age'", { instance: message });
            return message;
        };

        /**
         * Decodes a People message from the specified reader or buffer, length delimited.
         * @function decodeDelimited
         * @memberof simple.People
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @returns {simple.People} People
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        People.decodeDelimited = function decodeDelimited(reader) {
            if (!(reader instanceof $Reader))
                reader = new $Reader(reader);
            return this.decode(reader, reader.uint32());
        };

        /**
         * Verifies a People message.
         * @function verify
         * @memberof simple.People
         * @static
         * @param {Object.<string,*>} message Plain object to verify
         * @returns {string|null} `null` if valid, otherwise the reason why it is not
         */
        People.verify = function verify(message) {
            if (typeof message !== "object" || message === null)
                return "object expected";
            var properties = {};
            if (!$util.isString(message.name))
                return "name: string expected";
            if (!$util.isString(message.address))
                return "address: string expected";
            if (!$util.isString(message.phone_number))
                return "phone_number: string expected";
            if (!$util.isInteger(message.age))
                return "age: integer expected";
            if (message.location != null && message.hasOwnProperty("location")) {
                properties._location = 1;
                {
                    var error = $root.simple.Location.verify(message.location);
                    if (error)
                        return "location." + error;
                }
            }
            return null;
        };

        return People;
    })();

    simple.Location = (function() {

        /**
         * Properties of a Location.
         * @memberof simple
         * @interface ILocation
         * @property {string} region Location region
         * @property {string} country Location country
         */

        /**
         * Constructs a new Location.
         * @memberof simple
         * @classdesc Represents a Location.
         * @implements ILocation
         * @constructor
         * @param {simple.ILocation=} [properties] Properties to set
         */
        function Location(properties) {
            if (properties)
                for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                    if (properties[keys[i]] != null)
                        this[keys[i]] = properties[keys[i]];
        }

        /**
         * Location region.
         * @member {string} region
         * @memberof simple.Location
         * @instance
         */
        Location.prototype.region = "";

        /**
         * Location country.
         * @member {string} country
         * @memberof simple.Location
         * @instance
         */
        Location.prototype.country = "";

        /**
         * Creates a new Location instance using the specified properties.
         * @function create
         * @memberof simple.Location
         * @static
         * @param {simple.ILocation=} [properties] Properties to set
         * @returns {simple.Location} Location instance
         */
        Location.create = function create(properties) {
            return new Location(properties);
        };

        /**
         * Encodes the specified Location message. Does not implicitly {@link simple.Location.verify|verify} messages.
         * @function encode
         * @memberof simple.Location
         * @static
         * @param {simple.ILocation} message Location message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        Location.encode = function encode(message, writer) {
            if (!writer)
                writer = $Writer.create();
            writer.uint32(/* id 1, wireType 2 =*/10).string(message.region);
            writer.uint32(/* id 2, wireType 2 =*/18).string(message.country);
            return writer;
        };

        /**
         * Encodes the specified Location message, length delimited. Does not implicitly {@link simple.Location.verify|verify} messages.
         * @function encodeDelimited
         * @memberof simple.Location
         * @static
         * @param {simple.ILocation} message Location message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        Location.encodeDelimited = function encodeDelimited(message, writer) {
            return this.encode(message, writer).ldelim();
        };

        /**
         * Decodes a Location message from the specified reader or buffer.
         * @function decode
         * @memberof simple.Location
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @param {number} [length] Message length if known beforehand
         * @returns {simple.Location} Location
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        Location.decode = function decode(reader, length) {
            if (!(reader instanceof $Reader))
                reader = $Reader.create(reader);
            var end = length === undefined ? reader.len : reader.pos + length, message = new $root.simple.Location();
            while (reader.pos < end) {
                var tag = reader.uint32();
                switch (tag >>> 3) {
                case 1:
                    message.region = reader.string();
                    break;
                case 2:
                    message.country = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
                }
            }
            if (!message.hasOwnProperty("region"))
                throw $util.ProtocolError("missing required 'region'", { instance: message });
            if (!message.hasOwnProperty("country"))
                throw $util.ProtocolError("missing required 'country'", { instance: message });
            return message;
        };

        /**
         * Decodes a Location message from the specified reader or buffer, length delimited.
         * @function decodeDelimited
         * @memberof simple.Location
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @returns {simple.Location} Location
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        Location.decodeDelimited = function decodeDelimited(reader) {
            if (!(reader instanceof $Reader))
                reader = new $Reader(reader);
            return this.decode(reader, reader.uint32());
        };

        /**
         * Verifies a Location message.
         * @function verify
         * @memberof simple.Location
         * @static
         * @param {Object.<string,*>} message Plain object to verify
         * @returns {string|null} `null` if valid, otherwise the reason why it is not
         */
        Location.verify = function verify(message) {
            if (typeof message !== "object" || message === null)
                return "object expected";
            if (!$util.isString(message.region))
                return "region: string expected";
            if (!$util.isString(message.country))
                return "country: string expected";
            return null;
        };

        return Location;
    })();

    return simple;
})();